<template>
	<view class="c-switch-group">
		<slot />
	</view>
</template>

<script>
	export default {
		name: 'c-switch-group',
		created() {
			// 如果将children定义在data中，在微信小程序会造成循环引用而报错
			this.children = [];
		},
		methods: {
			emitEvent() {
				let values = [];
				this.children.forEach(val => {
					if(val.checked) values.push(val.label);
				})
				this.$emit('change', {
		            type: 'change',
		            detail: {
		                value: values
		            }
		        })
			}
		}
	}
</script>

<style scoped lang="scss">
	.c-switch-group{}
</style>
